package day240324.e2;

public class Person {
    String name;

    public Person(String name) {
        this.name = name;
    }

    public void adopt(Animal animal) {
        //如果 animal 是狗，多输出一句 汪汪汪
        if (animal instanceof Dog){
            System.out.println("汪汪汪...");
        }
        System.out.println(this.name + "养了一只" + animal.name);
    }
}

